package com.jwdf.uda.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.View;

import com.jwdf.uda.R;
import com.jwdf.uda.event.IndividualEvent;
import com.jwdf.uda.ui.fragment.base.BaseFragment;
import com.jwdf.uda.ui.fragment.user.personal.IndividualitySignatureFragment;
import com.jwdf.uda.utils.EventBusUtil;
import com.jwdf.uda.utils.UdaUtils;

/**
 * Created by Administrator on 2016/7/7.
 */
public class IndividualitySignatureActivity extends AbsTitleBarActivity {

    public static void start(Context context ,String signature) {
        Intent intent =new Intent(context, IndividualitySignatureActivity.class);
        intent.putExtra("signature", signature);
        context.startActivity(intent);
    }

    @Override
    protected Bundle onPutArguments() {
        Bundle args = new Bundle();
        args.putString("signature", getIntent().getStringExtra("signature"));
        return args;
    }

    @Override
    protected String getTopTitle() {
        String title = getString(R.string.individuality_signature);
        return title;
    }

    @Override
    protected void setupTitleView() {
        setOperateTitle(getString(R.string.head_operate_save));
    }

    @Override
    protected BaseFragment onCreateContentFragment() {
        return new IndividualitySignatureFragment();
    }

    @Override
    public void onHeadActionClick(View view) {
        EventBusUtil.post(new IndividualEvent(IndividualEvent.USER_INDIVIDUALITY_SIGNATURE));
    }

    @Override
    public void onHeadBackClick(View view) {
        //        EventBusUtil.post(new MessageNoticeEvent(MessageNoticeEvent.READ_ALL_MESSAGE));
        UdaUtils.hideInputMethod(this, view);
        FragmentManager manager = getSupportFragmentManager();
        int count = manager.getBackStackEntryCount();
        if(count == 0) {
           finish();
        } else {
            try {
                manager.popBackStackImmediate();
            } catch(IllegalStateException ignored) {
            }
        }
    }

}
